//
//  ZJBaseViewController.m
//  报销封装
//
//  Created by ZJ on 17/3/21.
//
//

#import "ZJBaseViewController.h"
#import "ZJAdditions.h"
@interface ZJBaseViewController ()

@end

@implementation ZJBaseViewController

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    [[LPShowNoDataManager showNoDataManager] removeEmptyView];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initUI];
}

- (void)initUI {
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.hidden = YES;
    [self.view addSubview:self.navigView];
    [self.navigView addSubview:self.statusVeiw];
    [self.navigView addSubview:self.leftButton];
    [self.navigView addSubview:self.rightButton];
    [self.navigView addSubview:self.titlelabel];
    self.rightButton.hidden = YES;
    
    self.titlelabel.text = self.title;
    
}
#pragma mark -- 点击事件

- (void)action_leftButton:(UIButton *)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)action_rightButton:(UIButton *)sender {
    
    
}

#pragma mark -- Getters And Setter
- (UIView *)statusVeiw{
    if (!_statusVeiw) {
        _statusVeiw = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], LP_StatusBarHeight)];
        _statusVeiw.backgroundColor = [UIColor themeColor];
    }
    return _statusVeiw;
}

- (UIView *)navigView{
    if (!_navigView){
        _navigView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen zj_screenWith], LP_TopHeight)];
        _navigView.backgroundColor = [UIColor themeColor];
    }
    return _navigView;
}

- (UIButton *)leftButton{
    if (!_leftButton){
        _leftButton = [[UIButton alloc]initWithFrame:CGRectMake(8, LP_StatusBarHeight, 44, 44)];
        [_leftButton setImage:[UIImage imageNamed:@"learn_pop_back"] forState:UIControlStateNormal];
        [_leftButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_leftButton addTarget:self action:@selector(action_leftButton:) forControlEvents:UIControlEventTouchUpInside];
        _leftButton.titleLabel.font = [UIFont systemFontOfSize:15 * [UIScreen zj_textFontScale]];
    }
    return _leftButton;
}

- (UIButton *)rightButton{
    if (!_rightButton){
        _rightButton = [[UIButton alloc]initWithFrame:CGRectMake([UIScreen zj_screenWith] - 48, LP_StatusBarHeight, 44, 44)];
        [_rightButton setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
        [_rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_rightButton addTarget:self action:@selector(action_rightButton:) forControlEvents:UIControlEventTouchUpInside];
        _rightButton.titleLabel.font = [UIFont systemFontOfSize:15 * [UIScreen zj_textFontScale]];
    }
    return _rightButton;
}

- (UILabel *)titlelabel{
    if (!_titlelabel){
        _titlelabel = [[UILabel alloc]initWithFrame:CGRectMake(54, LP_StatusBarHeight, [UIScreen zj_screenWith] - 108, 44)];
        _titlelabel.font = [UIFont systemFontOfSize:17 * [UIScreen zj_textFontScale]];
        _titlelabel.textColor = [UIColor whiteColor];
        _titlelabel.textAlignment = NSTextAlignmentCenter;
        _titlelabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
    }
    return _titlelabel;
}





@end
